#include "armordetector.hpp"
#include <iostream>
using namespace cv;

int main(){
    VideoCapture video("../blue.avi");
    Mat cameraMatrix = (Mat_<double>(3,3) <<
        2673.8, 0,      718.2889,
        0,      2673.2, 560.3110,
        0,      0,      1
    );
    Mat distCoeffs = (Mat_<double>(5,1) <<
        -0.2097, -0.4538, 0, 0, 0
    );
    Mat img;
    AD::Armor_Detector detector(img);
    detector.inputCameraParameter(cameraMatrix,distCoeffs);
    while(1){
        video >> img;
        if(img.empty()){
            video.set(cv::CAP_PROP_POS_FRAMES, 0);
            continue;
        }
        detector << img;
        detector.Detect();
        detector.drawDis();
        detector >> img;
        imshow("video",img);
        char key=waitKey(1);
        if(key=='a')break;
    }
}